/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package framework;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.nio.file.StandardCopyOption.*;


/**
 *
 * @author Josh
 * @class Class to handle copying of multiple files in a thread-safe manner. Uses java.nio.
 */
public class Copier {
    String[] source, target;
    
    public Copier(String[] s, String[] t) {
        source = s;
        target = t;
    }

    public synchronized String[] getSource() {
        return source;
    }

    public synchronized void setSource(String[] source) {
        this.source = source;
    }

    public synchronized String[] getTarget() {
        return target;
    }

    public synchronized void setTarget(String[] target) {
        this.target = target;
    }
    
    public synchronized void doCopy() throws IOException {
        
        for(int i = 0; i < source.length; i++) 
            Files.copy(Paths.get(source[i]), Paths.get(target[i]), StandardCopyOption.REPLACE_EXISTING);
            
            
        
    }
    
    
}
